Skip to content

Instantly share code, notes, and snippets.

View cahyowhy's full-sized avatar
🐞

cahyo wibowo cahyowhy

🐞
View GitHub Profile
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active November 14, 2024 09:13
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@jtan189
jtan189 / JavaPasswordSecurity.java
Created September 29, 2012 15:10
Java PBKDF2 Password Hashing Code
import java.security.SecureRandom;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.SecretKeyFactory;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
/*
* PBKDF2 salted password hashing.
* Author: havoc AT defuse.ca
@takien
takien / youtubeID.js
Last active May 3, 2024 12:41
Get YouTube ID from various YouTube URL using JavaScript
/**
* Get YouTube ID from various YouTube URL
* @author: takien
* @url: http://takien.com
* For PHP YouTube parser, go here http://takien.com/864
*/
function YouTubeGetID(url){
var ID = '';
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
@MarcDiethelm
MarcDiethelm / Contributing.md
Last active September 13, 2024 15:58
How to contribute to a project on Github

This text now lives at https://github.com/MarcDiethelm/contributing/blob/master/README.md. I turned it into a Github repo so you can, you know, contribute to it by making pull requests.


Contributing

If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.

@tzmartin
tzmartin / embedded-file-viewer.md
Last active October 25, 2024 02:37
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@guangrei
guangrei / script.php
Last active June 8, 2024 14:06
[PHP] pengecekan tanggal merah berdasarkan hari libur nasional dan hari minggu
<?php
//default time zone
date_default_timezone_set("Asia/Jakarta");
//fungsi check tanggal merah
function tanggalMerah($value) {
$array = json_decode(file_get_contents("https://raw.githubusercontent.com/guangrei/APIHariLibur_V2/main/calendar.json"),true);
//check tanggal merah berdasarkan libur nasional
if(isset($array[$value]) && $array[$value]["holiday"])
: echo"tanggal merah\n";
@dragonsinth
dragonsinth / errgroup_withcontext.go
Created February 5, 2020 03:53
Using errgroup.WithContext() in Golang server handlers
package main
import (
"context"
"encoding/json"
"fmt"
"io"
"log"
"sync/atomic"
"time"
@echohes
echohes / main.go
Last active March 9, 2023 08:13
golang errgroup example with context and subcontext for gracefull shutdown
package main
import (
"context"
"errors"
"fmt"
"log"
"os"
"os/signal"
"syscall"
@sesgoe
sesgoe / 01_scripts_and_styles.js
Last active May 30, 2024 09:26
Retool Realtime WebSocket
const webSocket = new WebSocket('wss://echo.websocket.org');
//Event listeners are the pillars upon which WebSockets are built. This event fires when the WebSocket is considered 'OPEN',
//which means that it has connected successfully.
webSocket.addEventListener('open', function(event) {
console.log('websocket connected successfully') //log this into the browser console so we can check if the websocket connected
});
//This is a global reference to the websocket that we created. We need this because otherwise multiple JS