This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, ... }: | |
with lib; | |
{ | |
imports = | |
[ | |
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix> | |
./machine-config.nix | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public bool Authenticate() | |
{ | |
var FacebookAppId = ConfigurationManager.AppSettings["FACEBOOK_APPID"]; | |
var FacebookAppSecret = ConfigurationManager.AppSettings["FACEBOOK_SECRET"]; | |
var cookie = Request.Cookies["fbs_" + FacebookAppId]; | |
if (cookie == null) return false; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, ... }: { | |
boot.kernelPackages = pkgs.linuxPackages_5_15; | |
users.users = { | |
tarn = { | |
isNormalUser = true; | |
extraGroups = [ "wheel" ]; | |
password = ""; | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This seems way too difficult for what you would expect to be a pretty common task; | |
// taking a search string from the user and finding documents which contain some or all of the terms | |
// in the search string. | |
// This function naively splits a search string into terms and finds documents | |
// which contain some or all of the terms. Does not handle quoted terms as or ignore case as it should. | |
public IEnumerable<SearchResult> Search(string searchString, string[] fields) | |
{ | |
// Spit the search string and return an empty list if no search string was provided. | |
if (string.IsNullOrEmpty(searchString)) return new List<SearchResult>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HEIGHT = 600 | |
WIDTH = 900 | |
class Vector | |
constructor:(@x,@y) -> | |
add: (other) -> | |
new Vector @x + other.x, @y + other.y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
public static class ExtensionMethods | |
{ | |
public static IEnumerable<T> ToList<T>(this T value) { | |
yield return value; | |
} | |
public static IEnumerable<U> SelectMany<T, U>(this IEnumerable<T> m, Func<T, IEnumerable<U>> k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:latest | |
WORKDIR /app | |
COPY . . | |
RUN yarn | |
CMD ["node", "index.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from datetime import datetime | |
def check(domain, referer): | |
url = 'https://' + domain + '/mesh/v1/category?location=com' | |
headers = { | |
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0', | |
'Accept': '*/*', | |
'Accept-Language': 'en-US,en;q=0.5', | |
'Access-Control-Request-Method': 'GET', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import yaml | |
from yaml.composer import Composer | |
from yaml.reader import Reader | |
from yaml.scanner import Scanner | |
from yaml.parser import Parser | |
from yaml.constructor import SafeConstructor | |
from yaml.resolver import Resolver | |
class CommentsScanner(Scanner): | |
def scan_to_next_token(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import yaml | |
from collections import OrderedDict | |
class OrderedDumper(yaml.SafeDumper): | |
pass | |
def _dict_representer(dumper, data): | |
return dumper.represent_mapping( | |
yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, | |
data.items()) |
NewerOlder