Skip to content

Instantly share code, notes, and snippets.

View sharuzzaman's full-sized avatar
🛠️
Building

Sharuzzaman Ahmat Raslan sharuzzaman

🛠️
Building
View GitHub Profile
@spookyahell
spookyahell / exe2version_info.py
Last active November 6, 2023 09:14
Using the python pefile lib to extract version information from an exe file
'''Licensed under the MIT License :)'''
import pefile
import pprint
pe = pefile.PE('example.exe')
string_version_info = {}
for fileinfo in pe.FileInfo[0]:
class Solution:
def lastRemaining(self, n):
"""
:type n: int
:rtype: int
"""
odd = True
remainder = n
startNum = 1
power = 1
@eduardcloud
eduardcloud / LambdaEfsBackup.py
Created September 19, 2017 10:14
Backup EFS file-system to S3 with lambda function
import boto3
import time
region = 'eu-west-1'
user_data_script = """#!/bin/bash
instanceid=$(curl http://169.254.169.254/latest/meta-data/instance-id)
cd /
mkdir moodledata
mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 fs-xxxxxxxxxxc.efs.eu-west-1.amazonaws.com:/ moodledata
tar czf mooodledata-backup-$(date +%d-%m-%Y_%H-%M).tar.gz /moodledata
aws s3 mv mooodledata-backup-*.tar.gz s3://xxxxxxxxx/
@bsamuel-ui
bsamuel-ui / test_log_name_bug.py
Last active August 24, 2017 08:56
Test if cloudformation can create stacks with CW log groups with the same name
template = '''
Resources:
LambdaLogGroup1234:
Type: "AWS::Logs::LogGroup"
Properties:
LogGroupName: !Join [ "", [ "/aws/lambda/", !Ref "AWS::StackName", "1234" ] ]
LambdaLogGroup:
Type: "AWS::Logs::LogGroup"
Properties: