Skip to content

Instantly share code, notes, and snippets.

View petscheit's full-sized avatar

Paul Etscheit petscheit

  • Berlin
  • 10:29 (UTC -12:00)
View GitHub Profile
use anchor_lang::prelude::*;
// use borsh::{BorshDeserialize, BorshSerialize};
#[program]
pub mod drop {
use super::*;
pub fn initialize_mint(ctx: Context<CreateMint>, supply: u64, decimals: u8, authority: Pubkey) -> ProgramResult {
let mint = &mut ctx.accounts.mint;
const { MerkleTree } = require('merkletreejs')
const SHA256 = require('crypto-js/sha256')
let users = initializeUsers(256);
function addAddress(index, address) {
users[index] = address;
}
function verifyProof(sorted, hex){
@petscheit
petscheit / vsplit
Last active October 21, 2020 20:23
# -------------------------------------------------------------------------
# convert .mov file into segments of .mp4 files. I use it to create 60 sec video for my insta cooking channel with one command
# vsplit "original.mov" segment_span_in_seconds # "$(( 1*59 ))"
# this is inefficient but it works and I don't want to dig deeper into ffmpeg
# -------------------------------------------------------------------------
vsplit() {
SRC="$1"
ffmpeg -i "$SRC" -qscale 0 output.mp4
ffmpeg -i output.mp4 -c:v libx264 -crf 22 -map 0 -segment_time ${2} -g 9 \
-sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*9)" \
post_test = Post.new
parser_test = Parser.new
parser_test.open_file('html-samples/hacker-news-post.html')
parser_test.comment_args.each do |comment_hash|
post_test.add_comment(Comment.new(comment_hash))
end
post_test.comments
var object = {
method : function() { code block},
}
@petscheit
petscheit / 8.js
Last active October 12, 2015 17:06
for (property in objectName) {
code block
}
objectName.property
objectName["String Key"]
objectName[expression_or_variable]
delete objectName.property
objectName.newProperty = value
anotherCar = Object.create( car );
anotherCar.manufacturer = "McLaren";
anotherCar.model = "P1";
console.log( anotherCar ); // Object {manufacturer: "McLaren", model: "P1"}
console.log( car ); // Object {manufacturer: "Bugatti", model: "Veyron"}