Skip to content

Instantly share code, notes, and snippets.

View sakti's full-sized avatar
🦀

Sakti Dwi Cahyono sakti

🦀
View GitHub Profile
#!/usr/bin/env bash
# Check whether this node can run microVMs (Firecracker, Cloud Hypervisor, etc).
#
# Usage: ./check-microvm-support.sh [-q]
# -q quiet mode: no output, just exit code (0 = supported, 1 = not supported)
set -uo pipefail
QUIET=0
[[ "${1:-}" == "-q" ]] && QUIET=1
package main
import (
"bufio"
"fmt"
"os"
"runtime/debug"
"time"
"github.com/allegro/bigcache"
@sakti
sakti / INSTALL.rst
Last active March 29, 2020 18:21 — forked from jensens/INSTALL.rst
sentry setup with docker-compose

In order to run this image do: docker-compose up -d to get all up. On first run DB initialization and initial user setup is done like so:

First start a bash in the container: docker-compose exec sentry /bin/bash. Then, inside bash, do sentry upgrade wait until it asks you for an inital user. When finished exit the bash.

When in doubt check with docker-compose ps if all went fine.

#!/usr/bin/env python
"download random text file from gutenberg project into current directory; `pip install Gutenberg` first"
import random
from gutenberg.acquire import load_etext
from gutenberg.cleanup import strip_headers
list_generated_random = []
def get_unique_random(lower, upper):
choice = random.randrange(lower, upper)
@sakti
sakti / keybase.md
Last active November 5, 2019 04:40

Keybase proof

I hereby claim:

  • I am sakti on github.
  • I am sakti (https://keybase.io/sakti) on keybase.
  • I have a public key ASC-LqJyXpkkHllCUASgevtxmlyseW8BllNGUa7pKY9Fzwo

To claim this, I am signing this object:

Hi :)
blog: www.saktidwicahyono.name
email: 54krpl@gmail.com
`gorm:"<annotation>;<annotation>"`
size:255
AUTO_INCREMENT
- // ignore this field
many2many:user_languages;
index
unique_index
type:varchar(100)
not null
@sakti
sakti / coba.py
Last active October 14, 2015 01:51
entries = Entry.objects.all()
for entry in entries:
print '%s %s %s' % (entry.blog.name, ','.join([item.name for item in entry.authors.all()]), entry.pub_date)
import time
n = 128
print 'decimal - binary - octal - hexadecimal'
print '======================================'
for i in range(n):
print '{0:04d} - {0:08b} - {0:08o} - {0:08x}'.format(i)
time.sleep(1)