Skip to content

Instantly share code, notes, and snippets.

@deidyomega
deidyomega / steps.md
Last active July 28, 2023 01:59
Adding Capacitor always fails for me

npm create vuetify

✔ Project name: … com.example.cap
✔ Which preset would you like to install? › Essentials (Vuetify, VueRouter, Pinia)
✔ Use TypeScript? … Yes
✔ Would you like to install dependencies with yarn, npm, or pnpm? › npm

... installs vue + vuetify + pinia

npm run build

@deidyomega
deidyomega / fubar.hs
Last active September 18, 2020 21:51
get_winner :: (Integer, Integer) -> Integer
get_winner (first, second)
| first > second = 1
| first < second = -1
| otherwise = 0
main = do
print $ get_winner $ (21, 52)
-- main.hs:40:1: error:
@deidyomega
deidyomega / main.dart
Created March 25, 2018 22:58
For article on mattharris.tech
// Import the JS interop library
import 'dart:js';
// export the js wrapper as the function you want, since I'm only exporting one, i used the handy => notation.
void main() => context['adder'] = jsAdder;
// This wraps adder, returning the object we created, now I made it return a map, since that's usually more useful.
Object jsAdder(num a,num b) {
return new JsObject.jsify(adder(a, b));
}
@deidyomega
deidyomega / sqlinjection.py
Created August 25, 2017 05:57
Simple Injection and secure code
from flask import Flask
import sqlite3
import os
from time import sleep
app = Flask(__name__)
def gen_test_data():
## Complete rebuild the db before build
try:
@deidyomega
deidyomega / codefights.py
Created December 9, 2016 02:23
Code Fight Python (incorrect)
import pprint
def CodeFight(n):
lst = []
for x in xrange(1,n+1):
if x % 5 == 0:
o = "Code"
elif x % 7 == 0:
o = "Fight"
else:
// ==UserScript==
// @name Facebook Ad Killer
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Kill All the Facebook Suggested Posts
// @author Matthew Harris
// @match https://www.facebook.com/*
// @grant none
// ==/UserScript==
from decimal import *
import math
def mem_fib(n, _cache={}):
'''efficiently memoized recursive function, returns a Fibonacci number'''
if n in _cache:
return _cache[n]
elif n > 1:
return _cache.setdefault(n, mem_fib(n-1) + mem_fib(n-2))
return n

To Run:

Needs to be root to create deamon, there are ways around this, but for this simple program I didn't build it it

sudo su python daemonizer.py

There wont be an output, because the program main ran in the background.

If you want to see it do something, make the my_main_loop connect to a db, and place a record in it

import requests
key = "API_KEY_HERE"
def getNPR(zipcode, key):
url = "http://api.npr.org/stations?apiKey={0}&format=json&zip={1}".format(key, zipcode)
r = requests.get(url)

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post