Skip to content

Instantly share code, notes, and snippets.

View skippednote's full-sized avatar

Bassam Ismail skippednote

View GitHub Profile
import fs from "node:fs";
const booksJSON = fs.readFileSync("./static/data/books.json", "utf-8");
const books = JSON.parse(booksJSON);
function slugify(str) {
return String(str)
.normalize("NFKD") // split accented characters into their base characters and diacritical marks
.replace(/[\u0300-\u036f]/g, "") // remove all the accents, which happen to be all in the \u03xx UNICODE block.
.trim() // trim leading or trailing whitespace
import { WebClient } from "@slack/web-api";
const token = process.env.SLACK_TOKEN;
const client = new WebClient(token);
async function main() {
try {
const { users } = await client.usergroups.users.list({
usergroup: "S0DG3F3FD",
});
export class SoftskillsStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const layer = lambda.LayerVersion.fromLayerVersionArn(
this,
'ffmpeg',
'arn:aws:lambda:us-east-1:448159408791:layer:ffmpeg:1'
);
import * as TranscribeService from 'aws-sdk/clients/transcribeservice';
const { TRANSLATIONS_BUCKET_NAME, CLIPS_BUCKET_ARN } = process.env;
const ts = new TranscribeService();
export const handler = async (event: any = {}): Promise<any> => {
try {
console.log(JSON.stringify(event, null, 2));
const { Records } = JSON.parse(event.Records[0].body);
Records.forEach(async (record: any) => {
const { object, bucket } = record.s3;
ARG DRUPALBASE_VERSION
ARG NODE_VERSION
FROM hussainweb/drupal-base:${DRUPALBASE_VERSION}
ENV TERM xterm
ENV QT_X11_NO_MITSHM 1
ENV _X11_NO_MITSHM 1
ENV _MITSHM 0
const fetch = require('node-fetch');
const request = async (url, data = {}) => {
const response = await fetch(`https://gitlab.com/api/v4/${url}`, {
headers: {
'PRIVATE-TOKEN': process.env.GITLAB_TOKEN,
...data.headers,
},
...data,
});
return response;
@skippednote
skippednote / format-toc.js
Created January 14, 2020 04:52
Sort videos downloaded from O'Reily Media as per their table of contents
const toc = require("./toc.json");
const fs = require("fs").promises;
tocU = toc.map(i => {
i.key = i.key.replace("/", "_");
i.entries = i.entries.map(e => e.replace("?", "").replace("/", "_"));
return i;
});
async function getVideosFromDirectory() {
const breakpoints = [
{
width: 1440,
height: 900,
scale: 1
},
{
width: 1024,
height: 768,
scale: 2

Keybase proof

I hereby claim:

  • I am skippednote on github.
  • I am skippednote (https://keybase.io/skippednote) on keybase.
  • I have a public key whose fingerprint is EDB0 32E4 B6F0 6D10 F6AE 9BBF 5D0F 8FB2 A91A 3478

To claim this, I am signing this object:

// OPERATORS
function map(transformFn) {
const inputObservable = this;
const outputObservable = createObservable(function subscribe(outputObserver) {
inputObservable.subscribe({
next: function(x) {
const y = transformFn(x);
outputObserver.next(y)
},
error: function(e) {