Skip to content

Instantly share code, notes, and snippets.

View guangrei's full-sized avatar
💭
I may be slow to respond.

Am K guangrei

💭
I may be slow to respond.
View GitHub Profile
@carlosabalde
carlosabalde / fire-and-forget.py
Created August 24, 2019 10:16
Simple Python fire & forget skeleton useful to launch heavy tasks as background processes
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
- Requirements:
+ python-daemon==2.2.3
'''
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
@simonw
simonw / recover_source_code.md
Last active September 28, 2024 08:10
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@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";
@abiosoft
abiosoft / Caddyfile
Created September 18, 2016 16:16
Caddy wordpress docker-compose
:80
root /usr/src/wordpress
gzip
fastcgi / wordpress:9000 php
rewrite {
if {path} not_match ^\/wp-admin
to {path} {path}/ /index.php?_url={uri}
}
log stdout
errors stderr
@danieltdt
danieltdt / install.sh
Created June 2, 2013 08:51
Install UnQLite as a shared library on Linux (tested on ubuntu 12.04).
#!/usr/bin/env bash
# Before executing it, you must download UnQLite source code (http://www.unqlite.org/downloads.html)
# unzip all the files and execute this script inside the unzipped folder. For example:
# mkdir /tmp/unqlite; cd /tmp/unqlite; unzip ~/Downloads/unqlite-db-116.zip
gcc -Wall -fPIC -c *.c
gcc -shared -Wl,-soname,libunqlite.so.1 -o libunqlite.so.1.0 *.o
sudo cp `pwd`/libunqlite.so.1.0 /usr/local/lib/
sudo cp `pwd`/unqlite.h /usr/local/include/
sudo ln -sf /usr/local/lib/libunqlite.so.1.0 /usr/local/lib/libunqlite.so.1