Skip to content

Instantly share code, notes, and snippets.

View darklow's full-sized avatar

Kaspars Sprogis darklow

View GitHub Profile
@darklow
darklow / calculate_jetton_address.py
Last active April 23, 2024 20:33
Calculate user's Jetton wallet address offline (USDT jetton example)
from pytoniq_core import Address, Cell, begin_cell
def calculate_jetton_address(
owner_address: Address, jetton_master_address: Address, jetton_wallet_code: str
):
# Recreate from jetton-utils.fc calculate_jetton_wallet_address()
# https://tonscan.org/jetton/EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs#source
data_cell = (
@darklow
darklow / 00-readme.md
Created July 27, 2023 09:22 — forked from JanJakes/00-readme.md
Ubuntu server with Nginx, uWSGI and Node.js installation & deployment setup

Ubuntu with Nginx, uWSGI & Node.js and it's deployment

This Gist contains instructions to setup Ubuntu server with Nginx, uWSGI & Node.js with that can serve for any Python apps (Django for instance) and will allow it's automatized deployment.

The content is as follows:

  • 01-ubuntu.md – A basic Ubuntu server setup.
  • 02-nginx-uwsgi-nodejs.md – Nginx, uWSGI and Node.js installation and setup.
  • 03-deployment.md – A server setup for automatized deployment.
  • 04-mariadb.md – Mariadb installation and setup.
@darklow
darklow / pycoin_custom_sign.py
Last active March 4, 2020 19:05
pycoin_custom_sign.py
from pycoin.encoding.hexbytes import b2h
from pycoin.intbytes import int2byte
from pycoin.key import Key
from pycoin.networks.registry import network_for_netcode
from pycoin.satoshi.der import sigencode_der
network = network_for_netcode('XTN')
Tx = network.tx
TxIn = network.tx.TxIn
@darklow
darklow / gist:21ed4b0036185a0dc9322e00672023f9
Created February 24, 2018 03:42
ElasticSearch cluster of 3x nodes (2 master/data + 1x master) on AWS EC2 using ec2 discovery plugin
# FILE: ./elastic-master/Dockerfile
FROM docker.elastic.co/elasticsearch/elasticsearch:6.2.2
RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch discovery-ec2
ARG AWS_ACCESS_KEY
ARG AWS_ACCESS_SECRET
RUN echo $AWS_ACCESS_KEY | /usr/share/elasticsearch/bin/elasticsearch-keystore add discovery.ec2.access_key
import Vue from 'vue'
// Event proxy/bus for sharing data across non-parent child components
// https://vuejs.org/v2/guide/components.html#Non-Parent-Child-Communication
const event = {
bus: null,
init() {
if (!this.bus) {
Facebook*:
https://api.facebook.com/method/links.getStats?urls=%%URL%%&format=json
+ works, returns shares, likes, comments and total
Twitter:
http://urls.api.twitter.com/1/urls/count.json?url=%%URL%%&callback=twttr.receiveCount
+ v1 API but still works
Reddit:
http://buttons.reddit.com/button_info.json?url=%%URL%%
SYSTEM_MODE(MANUAL);
//Disables connection to Spark Cloud without additional API query
// UDP Port used for two way communication
unsigned int localPort = 8888;
const char *message = "A";
unsigned int ssdpport = 1900;
IPAddress ip( 239, 255, 255, 250 );
SYSTEM_MODE(MANUAL);
// UDP Port used for two way communication
unsigned int localPort = 1900;
unsigned int trigger = D0;
//Creates buffer variable and gives it a size
#define MAX_SIZE 1024
char buffer[MAX_SIZE];
//Creates UDP manipulation variable
@darklow
darklow / SSDP Code
Last active August 29, 2015 14:12 — forked from anonymous/SSDP Code
SYSTEM_MODE(MANUAL);
//Disables connection to Spark Cloud without additional API query
// UDP Port used for two way communication
unsigned int localPort = 8888;
const char *message = "A";
unsigned int once = 0;
unsigned int ssdpport = 1900;
IPAddress ip( 239, 255, 255, 250 );
var selector = 'img' // Replace this with the selector for the element you want to make transformable
jQuery.getScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', function() {
jQuery.getScript('//cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js', function() {
(function() {
var $, applyTransform, getTransform, makeTransformable;
$ = jQuery;