Skip to content

Instantly share code, notes, and snippets.

View xtools-at's full-sized avatar

Martin xtools-at

View GitHub Profile
@CodeSigils
CodeSigils / ubuntu-remove-telemetry.sh
Last active October 15, 2024 20:08
Remove Ubuntu telemetry
#!/usr/bin/env bash
################ Description: ###################
# This script will disable all opt-out under
# Ubuntu 22.04 (Codename: Jammy Jellyfish).
# At first the telemetry domains will be resolved
# to the local host and second all telemetry services
# will be removed from the system.
# The following work has a system-wide effect not just
@ericlee42
ericlee42 / 00-token_read.mjs
Last active December 1, 2023 00:15
Metis Stardust WebSocket issue test scripts
// node --experimental-json-modules read.mjs
// node 17 only
import { ethers } from "ethers";
import { readFile } from "fs/promises";
import ERC20ABI from "./ERC20.json" assert { type: "json" };
const privateKey = await readFile("key.txt", { encoding: "utf-8" });
const rpcclient = new ethers.providers.WebSocketProvider(
"wss://stardust-ws.metis.io/"
@gullyn
gullyn / flappy.html
Last active May 4, 2024 15:35
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
@hasibdesk
hasibdesk / How to run multiple NodeJs app on same server and different domain and run all app concurrently using Nginx.md
Created November 30, 2019 03:49
Run multiple nodejs app in same server with different domain and run all app concurrently

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

Sometimes we need to run multiple nodejs app on same server with different domain or sub domain like admin.domain.com, api.domain.com and also need to run both nodejs or reactjs app concurrently. We can do this using 2 things , first of all we need to install nginx in our server for reverse proxy to connect different domain, and for running multiple nodejs app concurrently we can use PM2 NodeJs Process Manager

Please Make sure that you have installed these things on your server

  • NodeJS
@Stadicus
Stadicus / setup_clightning.md
Last active December 29, 2022 11:41
Setup c-lightning on Digital Ocean

E-Commerce c-lightning node on Digital Ocean

Prerequisites

  • based on small Digital Ocean VPS (1CPU / 1GB RAM) with Ubuntu 16.04
  • SSH keys are recommended, but not described here
  • (sub) domain name necessary for SSL certificate

UFW & basic stuff

Login as "root"

@aunyks
aunyks / erc721-example.sol
Last active April 12, 2024 00:56
My implementation of the ERC721 token standard. WARNING: THIS CODE IS FOR EDUCATIONAL PURPOSES. DO NOT DEPLOY TO THE NETWORK.
pragma solidity ^0.4.19;
contract ERC721 {
string constant private tokenName = "My ERC721 Token";
string constant private tokenSymbol = "MET";
uint256 constant private totalTokens = 1000000;
mapping(address => uint) private balances;
mapping(uint256 => address) private tokenOwners;
mapping(uint256 => bool) private tokenExists;
mapping(address => mapping (address => uint256)) private allowed;
mapping(address => mapping(uint256 => uint256)) private ownerTokens;
@jordansissel
jordansissel / keyboardcapture.go
Created September 26, 2017 05:08 — forked from obonyojimmy/keyboardcapture.go
go lang keyboard capture
package main
import (
"fmt"
"syscall"
//~ "time"
"unsafe"
"golang.org/x/sys/windows"
)
@mhuggins
mhuggins / README.md
Last active June 11, 2021 09:59
Snake.js

Simple snake game in JS.

Unfinished features & unaddressed issues:

  • No collision detection (no win/loss)
  • Pressing two directions in quick succession allows the snake to reverse direction on itself. (This is an issue with the FPS limiting vs. event-driven key handling.)
  • Food can spawn on top of the snake.
@aquabu
aquabu / over_under.sol
Last active May 22, 2018 20:44
demonstrating uint overflow and underflow in solidity
/* demonstrating uint overflow and underflow in ethereum solidity
this is why you need guards like:
if (balances[_to] + _amount < balances[_to]) throw;
*/
contract C {
// (2**256 - 1) + 1 = 0
function overflow() returns (uint256 _overflow) {
uint256 max = 2**256 - 1;
return max + 1;
}
@timaschew
timaschew / gulp-task.js
Last active December 4, 2021 18:34
proxy browser-sync server with express and secure everything with basic auth
// just add pass server as your task function
// Start a server with LiveReload to preview the site in
const OUTPUT_PARENT = 'dist'
const OUTPUT_DIRECTORY = OUTPUT_PARENT + '/browser-sync'
function server(done) {
browser.init({
server: {
directory: true,