Skip to content

Instantly share code, notes, and snippets.

View dav1dnix's full-sized avatar
🏠
Working from home

david dav1dnix

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@dav1dnix
dav1dnix / webreq.kt
Created April 22, 2021 21:54
send GET request to github lol
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.module.kotlin.readValue
import java.io.BufferedReader
import java.net.HttpURLConnection
import java.net.URL
import java.io.File
import kotlin.reflect.typeOf
class NewException(msg: String): Exception(msg)
@dav1dnix
dav1dnix / a.py
Created September 11, 2020 23:12
class Code(object):
def __init__(self, name, age):
self.name = name
self.age = age
if not isinstance(self.name, str) and isinstance(self.age, int):
raise TypeError("self.name is not string or self.age is not int.")
def showArgs(self):
print(f"Name: {self.name}, Age: {self.age}")
@dav1dnix
dav1dnix / fizzbuzz.hs
Created August 22, 2020 12:19
haskell fizzbuzz repl.it
-- "::" has type
fizz :: Int -> String
-- "|" pipe
-- If incremented in 15, 3 or 5 have this text
-- otherwise show number instead :^)
fizz n | n `mod` 15 == 0 = "FizzBuzz"
| n `mod` 3 == 0 = "Buzz"
| n `mod` 5 == 0 = "Fizz"
| otherwise = show n
class Triangle {
constructor(a, b, c, h) {
this.a = a;
this.b = b;
this.c = c;
this.h = h;
}
area() {
return `Area: ${this.b} * ${this.h} / 2 = ${(this.b * this.h) / 2}`;
}
package main
import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"net/http"
)
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(window,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){retur
@dav1dnix
dav1dnix / jsonrequest.go
Last active January 11, 2021 19:45
JSON GET request
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
)
// Remove anything in the structs that you don't care about, or any struct that you don't care about. Use JSON-to-Go (I am not using inline type definitions, as I prefer this way.)

Keybase proof

I hereby claim:

  • I am dps910 on github.
  • I am dps_ (https://keybase.io/dps_) on keybase.
  • I have a public key ASBYJK_gx1ggV5f6bOjDYl8e5mgpCt23YgWoE_KgAdJPFwo

To claim this, I am signing this object:

import os
from dotenv import load_dotenv
load_dotenv()
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix="-", description="/dev/urandom")
# command for playing /dev/random