Skip to content

Instantly share code, notes, and snippets.

View slaveofcode's full-sized avatar
🎯
Debugging

Aditya Kresna slaveofcode

🎯
Debugging
View GitHub Profile
@slaveofcode
slaveofcode / rsa.go
Created April 9, 2024 01:38 — forked from sohamkamani/rsa.go
Example of RSA encryption, decryption, signing, and verification in Go
package main
import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"encoding/base64"
"fmt"
)
@slaveofcode
slaveofcode / django-launch.json
Last active August 6, 2023 05:25
Sample Django Configuration launch.json VSCode (Visual Studio Code)
{
"version": "0.2.0",
"configurations": [
{
"name": "Django",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${workspaceRoot}/venv/bin/python3.4",
"program": "${workspaceRoot}/manage.py",
<!-- SEO / Google -->
<meta name="author" content="Author name here....">
<meta name="description" content="Description text here.....">
<link rel="canonical" href="URL here...">
<!-- Social: Twitter -->
<!-- After inserting META need to validate at https://dev.twitter.com/docs/cards/validation/validator -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@8bit_code">
<meta name="twitter:creator" content="8bit_code">
@slaveofcode
slaveofcode / go-build-all
Created September 18, 2022 11:08 — forked from eduncan911/go-build-all
Go Cross-Compile Script
#!/bin/bash
#
# GoLang cross-compile snippet for Go 1.6+ based loosely on Dave Chaney's cross-compile script:
# http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go
#
# To use:
#
# $ cd ~/path-to/my-awesome-project
# $ go-build-all
#
@slaveofcode
slaveofcode / Ranking.php
Created September 13, 2019 10:00 — forked from slogsdon/Ranking.php
Reddit Ranking Algorithms in PHP
<?php
/**
* Ranking Library
* contains alogrithms for story ranking
* Basically a PHP Implementation of reddits algorithms
*
* @author Lucas Nolte <lnolte@i.biz>
* @since 0.1
* @package Polska Wiadomosc
* @subpackage Libraries
@slaveofcode
slaveofcode / nsqd.service
Created May 18, 2021 17:43 — forked from a-r-g-v/nsqd.service
nsqd, nsqdlookupd systemd service files
[Unit]
Description=NSQD
After=network.target
[Service]
WorkingDirectory=/usr/local/nsq
ExecStart=/usr/local/nsq/bin/nsqd -http-address 127.0.0.1:4151 -tcp-address 127.0.0.1:4150 -lookupd-tcp-address 127.0.0.1:4160
ExecReload=/bin/kill -HUP $MAINPID
Type=simple
KillMode=process
@slaveofcode
slaveofcode / conditional.sh
Created April 20, 2021 04:14
if conditions for checking variable was set or exist on shell script
#!/bin/sh
a=1
b=2
# #Check whether they are equal
# if [ $a = $b ]
# then
# echo "a is equal to b"
# fi
@slaveofcode
slaveofcode / singleton.dart
Created March 24, 2021 18:17 — forked from theburningmonk/singleton.dart
Using Dart's factory constructor feature to implement the singleton pattern
class MyClass {
static final MyClass _singleton = new MyClass._internal();
factory MyClass() {
return _singleton;
}
MyClass._internal() {
... // initialization logic here
}
@slaveofcode
slaveofcode / browserless-unfurl.js
Created November 22, 2020 14:41 — forked from joelgriffith/browserless-unfurl.js
Unfurls a link into semantic data
import puppeteer from 'puppeteer';
function getTitle() {
if (document.querySelector('meta[property="og:title"]')) {
return document.querySelector('meta[property="og:title"]').content;
}
if (document.querySelector('[itemprop="name"]')) {
return document.querySelector('[itemprop="name"]').text;
}
if (document.querySelector('title')) {
@slaveofcode
slaveofcode / home-server.md
Created October 26, 2020 14:51 — forked from nileshtrivedi/home-server.md
Home Server setup: Raspberry PI on Internet via reverse SSH tunnel

Raspberry Pi on Internet via reverse SSH tunnel

HackerNews discussed this with many alternative solutions: https://news.ycombinator.com/item?id=24893615

I already have my own domain name: mydomain.com. I wanted to be able to run some webapps on my Raspberry Pi 4B running perpetually at home in headless mode (just needs 5W power and wireless internet). I wanted to be able to access these apps from public Internet. Dynamic DNS wasn't an option because my ISP blocks all incoming traffic. ngrok would work but the free plan is too restrictive.

I bought a cheap 2GB RAM, 20GB disk VM + a 25GB volume on Hetzner for about 4 EUR/month. Hetzner gave me a static IP for it. I haven't purchased a floating IP yet.