Skip to content

Instantly share code, notes, and snippets.

@mul14
mul14 / 00_etc-hosts.md
Last active June 13, 2024 10:05
/etc/hosts for Vimeo, Reddit, Imgur, GitHub, DigitalOcean, dll

Unblock Steam, Vimeo, Reddit, Imgur, GitHub, DigitalOcean, NPM, PayPal, dll

Saya support Internet Positif untuk memblokir porn, situs judi, dan hal-hal ilegal lainnya. Tapi pemerintah dan ISP sangat konyol karena tidak mengizinkan akses ke Vimeo, Reddit, Imgur, Netflix--yang mana bukanlah situs dengan konten utama ilegal.

Linux / BSD / macOS

Tambahkan list di bawah ke /etc/hosts.

Windows

@VanDalkvist
VanDalkvist / execution-time.js
Created April 1, 2016 13:51
How to Measure Execution Time in Node.js
var start = new Date();
var hrstart = process.hrtime();
setTimeout(function (argument) {
// execution time simulated with setTimeout function
var end = new Date() - start,
hrend = process.hrtime(hrstart);
console.info("Execution time: %dms", end);
console.info("Execution time (hr): %ds %dms", hrend[0], hrend[1]/1000000);
@ahmdrz
ahmdrz / dump.go
Created September 23, 2016 08:07
Golang Reflection Example of an array.
package main
import (
"fmt"
"reflect"
)
type Test struct {
Name string
}
@Birdie0
Birdie0 / ifttt-webhooks-extended-guide.md
Last active March 6, 2024 13:38
How to use Discord Webhooks

⚠️ This gist is no longer updated! For maintained, improved and even more extended guide click here.


How to use Discord Webhook

It's a JSON

First, learn JSON. It's not programming language, not even close. Just follow syntax rules and you will be fine.

@zulhfreelancer
zulhfreelancer / install-docker.md
Last active May 25, 2024 08:06
Install Docker oneliner script

Just install Docker

$ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh

Install Docker and Rancher Server

$ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh && sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server

@virolea
virolea / upload.js
Last active June 11, 2024 06:48
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
var syncDep;
function getLottery() {
return new Promise((resolve, reject) =>{
if (syncDep === undefined) { //check of we already have this data...if not THEN go get
setTimeout(function() {
syncDep = [1,22,34,56,5];
resolve(syncDep);
}, 2000);
} else {
@gibatronic
gibatronic / README.md
Last active January 25, 2024 21:46
Tab completion for the npx command

complete_npx

Bash tab completion for the npx command

Usage

Save complete_npx in your home folder and then source it on your .bash_profile with:

. ~/complete_npx.sh
@andhikayuana
andhikayuana / gradle.properties
Last active September 22, 2023 04:31
publishing aar
libraryGroupId=yuana.id
libraryArtifactId=anu
libraryVersion=1.0.0
@ninoseki
ninoseki / test.ts
Created September 5, 2018 23:08
Send a screenshot (by using puppeteer) to Slack
import request from "request";
import puppeteer from "puppeteer";
const API_URL = "https://slack.com/api/files.upload";
const SLACK_API_TOKEN = process.env.SLACK_API_TOKEN as string;
const CHANNEL = "general";
(async () => {
const url = "http://neverssl.com"
const browser = await puppeteer.launch();